package com.fjwt.gz.service.activity.platform.acte017;

import com.fjwt.gz.db.dto.ActivityAwardDTO;
import com.fjwt.gz.db.entity.SysExportTaskEntity;
import com.fjwt.gz.db.vo.StatActe017NumVO;
import com.fjwt.gz.service.activity.AbstractExportReport;
import com.fjwt.gz.service.impl.StatActe017NumService;
import com.fjwt.gz.service.mapper.StatActe017NumMapper;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * ------ 越减越便宜-通报表（机构明细）
 * @author myf
 */
@Slf4j
@Service
public class AgentDetailExportReport extends AbstractExportReport<StatActe017NumVO> {


    @Autowired
    private StatActe017NumMapper statActe017NumMapper;


    private static final Map<String, String> HEADER_ALIAS_MAP = new HashMap<>();
    static {
        HEADER_ALIAS_MAP.put("agentNo4", "网点编码");
        HEADER_ALIAS_MAP.put("agentName4", "网点名称");
        HEADER_ALIAS_MAP.put("agentNo3", "网点归属区县编码");
        HEADER_ALIAS_MAP.put("agentName3", "区县机构");
        HEADER_ALIAS_MAP.put("joinManNum", "参与客户人数");
        HEADER_ALIAS_MAP.put("joinManTime", "参与客户人次");
        HEADER_ALIAS_MAP.put("afterB2AuthManNum", "郑邮享参与客户实名提升人数（通过B2券）");
        HEADER_ALIAS_MAP.put("afterAuthManNum", "郑邮享参与客户实名提升人数（全量渠道）.");
        HEADER_ALIAS_MAP.put("promoteManNum", "客户激发人数（除A券外权益激发情况）");
        HEADER_ALIAS_MAP.put("totalB1SendNum", "B1券发放人次");
        HEADER_ALIAS_MAP.put("totalB1GetNum", "B1券发放激活人次（以入链机构为归属）");
        HEADER_ALIAS_MAP.put("totalB1ActiveNum", "B1券网点激活人次（以激活机构为归属）");
        HEADER_ALIAS_MAP.put("totalB2GetNum", "B2福分发放人次");
        HEADER_ALIAS_MAP.put("totalB3SendNum", "B3券发放人次");
        HEADER_ALIAS_MAP.put("totalB3GetNum", "B3券发放激活人次（以入链机构为归属）");
        HEADER_ALIAS_MAP.put("totalB3ActiveNum", "B3券网点激活人次（以激活机构为归属）");
        HEADER_ALIAS_MAP.put("totalCSendNum", "C券发放人次");
        HEADER_ALIAS_MAP.put("totalCGetNum", "C券发放激活人次（以入链机构为归属）");
        HEADER_ALIAS_MAP.put("totalCActiveNum", "C券发放激活人次（以激活机构为归属）");
        HEADER_ALIAS_MAP.put("totalDSendNum", "D实物发放人次");
        HEADER_ALIAS_MAP.put("totalDGetNum", "D实物发放激活人次（以入链机构为归属）");
        HEADER_ALIAS_MAP.put("totalDActiveNum", "D实物网点激活人次（以激活机构为归属）");
    }


    @Override
    public String exportActivityExcel(SysExportTaskEntity sysExportTaskEntity) {
        ActivityAwardDTO activityAwardDTO = getRequestParam(sysExportTaskEntity.getRequestParam(), ActivityAwardDTO.class);
        List<StatActe017NumVO> result = statActe017NumMapper.getActAgentDetaiList(activityAwardDTO);
        return createExcelAndUploadOssUrl(result, HEADER_ALIAS_MAP, sysExportTaskEntity);
    }
}
